package book;

import java.util.Arrays;

public class BookList {
    private Book[] booklist;
    private int count;//记录书的数量

    public BookList() {
        count = 3;
        booklist = new Book[4];
        booklist[0] = new Book("西游记","吴承恩",123.45,"小说");
        booklist[1] = new Book("水浒传","施耐庵",100,"小说2");
        booklist[2] = new Book("三国演义","罗贯中",12.3,"小说3");

    }

    public Book[] getBooklist() {
        return booklist;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    //对书架进行扩容
    public void expansion() {
        if(this.booklist.length==this.count) {
            booklist=Arrays.copyOf(booklist,booklist.length*2);
            System.out.println("书架已满，增容成功");
        }
    }
}